home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / test_lj.pro < prev    next >
Text File  |  1997-07-08  |  11KB  |  338 lines

  1. ; $Id: test_lj.pro,v 1.4 1997/01/15 03:11:50 ali Exp $
  2. ;
  3. ; Copyright (c) 1990-1997, Research Systems, Inc.  All rights reserved.
  4. ;       Unauthorized reproduction prohibited.
  5.  
  6. pro lj_loadct,sixteen=sixteen,eight=eight,four=four
  7. ;+
  8. ;
  9. ;   Procedure to load a group of 16, 8, or 4 (depending on keyword)
  10. ;    colors for the LJ-250 .  If 8 or fewer colors are to be defined, it is
  11. ;    assumed that 180 dpi resolution mode will be accessed.  In this case,
  12. ;    selection is from a pre-defined set of 8 colors. For 16 colors, any
  13. ;    combination of the 256 available LJ-250 colors may be selected.
  14. ;    The group chosen here is an attempt to select a table which uses
  15. ;    a variety of colors, while maintaining some gradation between color
  16. ;    intensities.
  17. ;
  18. ;-
  19. if keyword_set(sixteen) then begin   ; 16 color specification is controllable
  20.    ; [black,med_gray,lt_gray,lt_blue,royal_blue,blue,lavendar,
  21.    ;  aqua,dark_green,green,lt_green,red,orange,yellow,lt_yellow,white]
  22.    r=2.55*[4,15,43,38,2,5,20,2,4,12,37,53,72,89,89,90]
  23.    g=2.55*[4,16,43,58,22,5,5,24,9,38,58,8,41,83,88,88]
  24.    b=2.55*[8,18,45,78,64,31,29,41,11,18,49,14,13,13,54,85]
  25. endif else if keyword_set(eight) then begin   ; 8 color selection is fixed
  26.    ; [black,blue,yellow,magenta,cyan,red,green,white] ; Keep highest white
  27.    r=[10,10,227,135,5,135,8,229]
  28.    g=[10,10,212,13,56,20,66,224]
  29.    b=[15,74,33,64,163,36,56,217]
  30. endif else if keyword_set(four) then begin  ; Keep highest (background) white
  31.    ; [black,blue,yellow,white]
  32.    r=[10,10,227,229]
  33.    g=[10,10,212,224]
  34.    b=[15,74,33,217]
  35. endif else print,'Unable to load lj color table; keyword expected.'
  36. tvlct,r,g,b   ; Just loads the first 8 or 16 values, the rest are unchanged
  37. return
  38. end
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45. pro lj_plot_test
  46. ;+
  47. ;
  48. ;   Procedure to test the basic plotting capabilities of the LJ-250 driver,
  49. ;     including color selection.
  50. ;
  51. ;-
  52. olddevice=!d.name
  53. set_plot,'lj'
  54. device,depth=3,/land,xsize=8,ysize=6,/inches,file='lj_plot_test.lj'
  55. old_pmulti=!p.multi
  56. !p.multi=[4,2,2,0,0]
  57. x=cos(6*(findgen(60)+1)/!radeg)
  58. y=sin(6*(findgen(60)+1)/!radeg)
  59. lj_loadct,/eight
  60. plot,x,xtitle='!8Complex Italic',ytitle='!5Duplex Roman', $
  61.   title='!12Dashed, Diamonds, Blue fill!3',linestyle=2,xrange=[0,60],xsty=1
  62. oplot,y,linestyle=0,psym=-4  ; diamonds connected by solid line
  63. index=[indgen(60),reverse(indgen(60))]
  64. fillpts=[x,reverse(y)]
  65. polyfill,index,fillpts,color=1   ; Should fill with blue
  66. ;polyfill,index,fillpts,spacing=0.8,orientation=135   ;Finish crosshatch
  67. ;
  68. v=dist(100)
  69. contour,v,levels=[10,20,30,40,50],c_labels=[1,1,1,1,1], $
  70.   c_annotation=['!3Ten','!5Twenty','!6Thirty','!8Forty','!12Fifty!3'], $
  71.   color=3,title='Five levels, Magenta'
  72. ;
  73. v=dist(20)
  74. surface,v,title='Simple Surface (no color)'
  75. ;
  76. x=[0,0,4,4,0]
  77. y=[0,2,2,0,0]
  78. plot,x,y,/nodata,title='Test of PLOTS, red interior channel'
  79. f=0.25
  80. for i=1,4 do $
  81.  plots,[0+i*f,0+i*f,4-i*f,4-i*f,0+i*f],[0+i*f,2-i*f,2-i*f,0+i*f,0+i*f],linest=i
  82. xcoord=[0.1,3.9,3.9,0.1,0.1,0.2,3.8,3.8,0.2,0.2]
  83. ycoord=[0.1,0.1,1.9,1.9,0.1,0.2,0.2,1.8,1.8,0.2]
  84. polyfill,xcoord,ycoord,color=5  ; fill interior box with red
  85. xyouts,0,0,'!6Unclipped, enlarged line at 45 degrees!3',/noclip, $
  86.  size=1.6,orientation=45
  87. ;
  88. !p.multi=old_pmulti
  89. device,/close
  90. set_plot,olddevice
  91. return
  92. end
  93.  
  94.  
  95.  
  96.  
  97.  
  98. pro lj_line_test
  99. ;+
  100. ;
  101. ;   Procedure to test the monochrome linestyle capability of the IDL 
  102. ;     LJ-250 driver.
  103. ;
  104. ;-
  105. olddevice=!d.name
  106. set_plot,'lj'
  107. device,/land,depth=1,xsize=8,ysize=6,/inches,file='lj_line_test.lj'
  108. plot,[0,1],[1,1],xstyle=1,xrange=[-0.2,1.2],ystyle=1,yrange=[0,2],/nodata, $
  109.   xticks=14,xticklen=0.04,xtitle='14 Tick Intervals', $
  110.   title='!8Test of Linestyles (Thick Lines)',ytitle='!8Avail. Styles!3'
  111. for i=0,5 do begin
  112.    oplot,[0,1],[0.1+(0.3*i),0.1+(0.3*i)],linestyle=i,thick=5.0
  113.    xyouts,0.2,(0.2+(0.3*i)), $
  114.     '!8Linestyle: '+string(i,'(i1)')
  115. endfor
  116. device,/close
  117. set_plot,olddevice
  118. return
  119. end
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126. pro lj_image_test
  127. ;+
  128. ;
  129. ;   Procedure to generate a series of TV images on a page, for an LJ-250 driver
  130. ;     test.  Monochrome (depth=1) is used, so that the dithering may be tested.
  131. ;
  132. ;-
  133. olddevice=!d.name
  134. set_plot,'lj'
  135. v = bytscl(dist(600))
  136. v=255-v*(v lt 180)
  137. v[300,*]=0    ;Dark line
  138. v[*,300]=0    ;Crossing dark line
  139. device,resol=180,/land,xsize=10*180,ysize=6*180,xoffset=90,yoffset=180, $
  140.        /pixels,/floyd,file='lj_image_test.lj',depth=1
  141. tv,v,0,180   ; Move up 1 inch to allow room for label below
  142. xyouts,200,90,/device,'!6Floyd'
  143. device,/ordered
  144. tv,v,690,180  ; Should be 1/2 inch gap between images
  145. xyouts,890,90,/device,'Ordered'  ; Should continue to use !6 font
  146. xyouts,640,180,/device,orientation=90,'1/2 inch gap here, 90 deg. rotation'
  147. device,threshold=100              ; Should create small black swaths
  148. ;tv,v,1380,180  ; NOTE: this doesn't work because monochrome, & outside area
  149. tv,v[0:399,*],1380,180   ;Deliberately avoid last 200 pixels to fit plot area
  150. xyouts,(1580./1800.),(90./1080.),/normal,'!6Threshold!3'
  151. xyouts,1330,780,/device,orientation=270,'270 deg. rot., last inch truncated'
  152. device,/close
  153. set_plot,olddevice
  154. return
  155. end
  156.  
  157.  
  158.  
  159.  
  160.  
  161. pro lj_resolution_test
  162. ;+
  163. ;
  164. ;   Procedure to test landscape and portrait graphics using both 90 and 180 dpi
  165. ;      LJ-250 resolutions.  A total of four output files will be generated.
  166. ;
  167. ;-
  168. olddevice=!d.name
  169. set_plot,'lj'
  170. ;
  171. device,depth=4,resol=90,/land,xsize=20,ysize=12.5,xoffset=2.5,yoffset=2.5, $
  172.   file='lj_90_land_cm.lj'
  173. lj_loadct,/sixteen    ; Load first 16 indices in color table with known colors
  174. surface,dist(20),title='!6land, 90res, 20x12.5cm, 2.5x2.5cm off, color Red!3',$
  175.    color=11
  176. device,/close
  177. ;
  178. device,depth=4,resol=90,/port,xsize=6,ysize=4,xoffset=1,yoffset=1,/inches, $
  179.   file='lj_90_port_inches.lj'
  180. lj_loadct,/sixteen    ; Load first 16 indices in color table with known colors
  181. surface,dist(20),title='!6port, 90res, 6x4in, 1x1 off, color Lt. Gray!3', $
  182.    color=2
  183. device,/close
  184. ;
  185. device,depth=3,resol=180,/land,xsize=6,ysize=6,xoffset=2.0,yoffset=2.0, $
  186.   /inches,file='lj_180_land_inches.lj'
  187. lj_loadct,/eight    ; Load first 8 indices in color table with known colors
  188. surface,dist(20),title='!6land, 180res, 6x6in, 2x2 off, color Cyan!3', $
  189.    color=4
  190. device,/close
  191. ;
  192. device,depth=3,resol=180,/port,xsize=1080,ysize=720,xoffset=180,yoffset=360, $
  193.   /pixels,file='lj_180_port_pixels.lj'
  194. lj_loadct,/eight    ; Load first 8 indices in color table with known colors
  195. surface,dist(20),title='!6port, 180res, 1080x720, 180x360 off, color Green!3',$
  196.    color=6
  197. device,/close
  198. ;
  199. set_plot,olddevice
  200. return
  201. end
  202.  
  203.  
  204.  
  205.  
  206. pro lj_depth_test
  207. ;+
  208. ;
  209. ;    Procedure to create two disk files illustrating different depth
  210. ;    (bit plane) renditions available on the LJ-250 .
  211. ;
  212. ;-
  213. olddevice=!d.name
  214. set_plot,'lj'
  215. image=dist(360)
  216. ;
  217. device,/port,resol=180,depth=3,xsize=3,ysize=3,/inches, $
  218.    file='lj_depth123_test.lj'
  219. lj_loadct,/eight   ; load THE 8 colors for use in 180 dpi mode
  220. tv,bytscl(image,top=7),0,90
  221. xyouts,0,40,'Depth 3, 180 dpi, Portrait',/device
  222. ;
  223. device,/land,depth=2,resolution=90,xsize=5,ysize=5,/inches
  224. lj_loadct,/four   ; load 4 colors for use in 180 dpi mode, 2 bit planes
  225. tv,bytscl(image,top=3),180,90   ; Should cleanly truncate last 1 inch on right
  226. xyouts,270,50,'Depth 2, 90 dpi, Land, last inch truncated',/device
  227. xyouts,100,90,orient=90,'Right inch of image & text should be clipped',/device
  228. ;
  229. device,/port,depth=1,resolution=180,xsize=3,ysize=3,/inches
  230. tv,image,90,90
  231. xyouts,90,40,'Depth 1, 180 dpi, Portrait, Mono',/device
  232. device,/close
  233. ;
  234. device,/land,resol=90,depth=4,file='lj_depth4_test.lj'
  235. lj_loadct,/sixteen   ; Load 16 colors for use at 90 dpi resolution
  236. image=bytscl(image,top=15)  ; Set image range to match 16 selected colors
  237. for i=0b,15 do image[22*i,0]=bytarr(22,22)+i   ; Place color bar at bottom
  238. tv,image,0,90
  239. xyouts,90,45,'Depth 4, 90 dpi, Land, 16 color bar',/device
  240. device,/close
  241. set_plot,olddevice
  242. return
  243. end
  244.  
  245.  
  246.  
  247.  
  248.  
  249. pro lj_show3_test
  250. ;+
  251. ;
  252. ;   Procedure to create an output file for use on the LJ-250, which will
  253. ;     use the library procedure SHOW3.
  254. ;
  255. ;-
  256. olddevice=!d.name
  257. set_plot,'lj'
  258. device,/land,depth=3,resolution=180,filename='lj_show3_test.lj'
  259. ljlct   ; Test this routine to load the default palette
  260. show3,dist(16)
  261. device,/close
  262. set_plot,olddevice
  263. return
  264. end
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271. pro test_lj
  272. ;+
  273. ; NAME:
  274. ;    test_lj
  275. ; PURPOSE:
  276. ;    To exercise and demonstrate various aspects of the IDL driver for
  277. ;       the Digital Equipment Corporation LJ-250 color printer.
  278. ; CATEGORY:
  279. ;    Graphics Drivers.
  280. ; CALLING SEQUENCE:
  281. ;    test_lj - Calls all test procedures, which may also be individually
  282. ;           called:
  283. ;    lj_plot_test       - plot, contour, surface, plots, and vector fonts
  284. ;    lj_line_test       - test of linestyles
  285. ;    lj_image_test      - raster image output, for various dithering options
  286. ;    lj_resolution_test - test the two available resolutions (90 and 180dpi)
  287. ;    lj_depth_test      - test different depth (bit plane) renditions
  288. ;    lj_show3_test      - test the output using the SHOW3 procedure
  289. ; INPUTS:
  290. ;    None
  291. ; OPTIONAL INPUT PARAMETERS:
  292. ;    None
  293. ; KEYWORD PARAMETERS:
  294. ;    None
  295. ; OUTPUTS:
  296. ;    Creates LJ-250 compatible disk files: lj_plot_test.lj, lj_line_test.lj,
  297. ;          lj_image_test.lj, lj_90*.lj, lj_180*.lj, lj_depth123_test.lj,
  298. ;       lj_depth4_test.lj, and lj_show3_test.lj .
  299. ;       These files are not automatically submitted for printing; neither
  300. ;       are they deleted automatically.
  301. ;    To print the .lj files properly on a VMS system, it is recommended
  302. ;       that the /PASSALL qualifier be used with the PRINT command, to
  303. ;       pass all file information directly to the lj printer.
  304. ; OPTIONAL OUTPUT PARAMETERS:
  305. ;    None
  306. ; COMMON BLOCKS:
  307. ;    None
  308. ; SIDE EFFECTS:
  309. ;    Many .lj files will be created and left in the default directory.
  310. ; RESTRICTIONS:
  311. ;    Designed for IDL Version 2; not compatible with VMS IDL Version 1.
  312. ; PROCEDURE:
  313. ;    The called routines try different permutations of the allowable
  314. ;       keywords to the DEVICE procedure for the LJ-250.  Vector plotting,
  315. ;       contour, line drawing, and surface plots are generated, as well 
  316. ;       as a series of images which test all dithering methods.
  317. ;       The two resolutions of the LJ-250 are tested, and specific color
  318. ;       maps are used and tested.
  319. ; MODIFICATION HISTORY:
  320. ;    Written, August 1990, TJA (derived from demo_pcl)
  321. ;-
  322. lj_plot_test
  323. print,'File lj_plot_test.lj has been completed.'
  324. lj_line_test
  325. print,'File lj_line_test.lj has been completed.'
  326. lj_image_test
  327. print,'File lj_image_test.lj has been completed.'
  328. lj_resolution_test
  329. print,'Files lj_90*.lj, and lj_180*.lj have been completed.'
  330. lj_depth_test
  331. print,'Files lj_depth123_test.lj, and lj_depth4_test.lj have been completed.'
  332. lj_show3_test
  333. print,'File lj_show3_test.lj has been completed.'
  334. print,' '
  335. print,'*** All Finished ***'
  336. return
  337. end
  338.